package com.kfyang.manualgear.generator.impl.hibernate.orm;

import com.kfyang.manualgear.annotation.comment.Example;
import com.kfyang.manualgear.generator.declare.orm.OrmGenerator;

import javax.lang.model.element.ExecutableElement;
import javax.lang.model.type.TypeMirror;
import java.util.List;

@Example
public class OrmGeneratorHibernateImpl extends OrmGenerator {
    public OrmGeneratorHibernateImpl(List<ExecutableElement> elements, TypeMirror entityType) {
        super(elements, entityType);
    }

    @Override
    protected void generateSelectMethod(boolean forOne) {
        if (forOne) {
            methodBuilder.addStatement("return entityManager.find($T.class, id)", entityInfo.entityTypeName);
        }
    }

    @Override
    protected void generateInsertMethod(boolean forOne) {

    }

    @Override
    protected void generateUpdate() {

    }

    @Override
    protected void generateDeleteMethod(boolean forOne) {

    }
}
